package se.webbzon.boltzmann.editor.list;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.JComponent;

public abstract class EditorListCell extends JComponent {
	
	// The default font
	private static final Font font = new Font("Arial",Font.BOLD,12);
	
	// The colors of this cell
	private static final Color 	normal = Color.white,
								selected = new Color(112,146,190);
	
	// Auto generated serial version UID
	private static final long serialVersionUID = -4687592989205629273L;

	// Whatever the cell is selected
	private boolean isSelected;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new abstract editor list cell. **/
	public EditorListCell(Dimension d) {
		setPreferredSize(d);
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the font if this editor list cell. **/
	public Font getFont() {
		return font;
	}
	
	/** Sets whatever the cell is selected. **/
	public void setSelected(boolean selected) {
		this.isSelected = selected;
	}
	
	/** Returns true if the cell is selected. **/
	public boolean isSelected() {
		return isSelected;
	}
	
	@Override public void paintComponent(Graphics g) {
		if (isSelected)
			g.setColor(selected);
		else
			g.setColor(normal);
		g.fillRect(0, 0, getWidth()-1, getHeight()-1);
		g.setColor(Color.black);
	}

}
